= render 'shared/push_rules/commit_committer_check_setting', form: f, push_rule: f.object, context: context
= render 'shared/push_rules/commit_committer_name_check_setting', form: f, push_rule: f.object, context: context
= render 'shared/push_rules/reject_unsigned_commits_setting', form: f, push_rule: f.object, context: context
= render 'shared/push_rules/reject_commits_not_dco_signed_setting', form: f, push_rule: f.object, context: context
- wiki_syntax_link_url = 'https://github.com/google/re2/wiki/Syntax'
- wiki_syntax_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: wiki_syntax_link_url }

- secret_files_link_url = help_page_path('user/project/repository/push_rules', anchor: 'prevent-pushing-secrets-to-the-repository')
- secret_files_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: secret_files_link_url }

= f.gitlab_ui_checkbox_component :deny_delete_tag,
    s_("PushRules|Do not allow users to remove Git tags with %{code_block_start}git push%{code_block_end}").html_safe % { code_block_start: '<code>'.html_safe, code_block_end: '</code>'.html_safe },
    checkbox_options: { data: { qa_selector: 'deny_delete_tag_checkbox' } },
    help_text: s_('PushRules|Users can still delete tags through the GitLab UI.')

= f.gitlab_ui_checkbox_component :member_check,
    s_("PushRules|Check whether the commit author is a GitLab user"),
    checkbox_options: { data: { qa_selector: 'restrict_author_checkbox' } },
    help_text: s_('PushRules|Restrict commits to existing GitLab users.')

= f.gitlab_ui_checkbox_component :prevent_secrets,
    s_("PushRules|Prevent pushing secret files"),
    checkbox_options: { data: { qa_selector: 'prevent_secrets_checkbox' } },
    help_text: s_("PushRules|Reject any files likely to contain secrets. %{secret_files_link_start}What secret files are rejected?%{secret_files_link_end}").html_safe % { secret_files_link_start: secret_files_link_start, secret_files_link_end: '</a>'.html_safe }

.form-group
  = f.label :commit_message_regex, s_("PushRules|Require expression in commit messages"), class: "label-bold"
  = f.text_field :commit_message_regex, class: "form-control", placeholder: _('Example: Fixes \d+\..*'), data: { qa_selector: 'commit_message_field' }
  .form-text.text-muted
    = s_("PushRules|All commit messages must match this %{wiki_syntax_link_start}regular expression%{wiki_syntax_link_end}. If empty, commit messages are not required to match any expression.").html_safe % { wiki_syntax_link_start: wiki_syntax_link_start, wiki_syntax_link_end: '</a>'.html_safe }

.form-group
  = f.label :commit_message_negative_regex, s_("PushRules|Reject expression in commit messages"), class: 'label-bold'
  = f.text_field :commit_message_negative_regex, class: "form-control", placeholder: _('Example: ssh\:\/\/'), data: { qa_selector: 'deny_commit_message_field' }
  .form-text.text-muted
    = s_("PushRules|Commit messages cannot match this %{wiki_syntax_link_start}regular expression%{wiki_syntax_link_end}. If empty, commit messages are not rejected based on any expression.").html_safe % { wiki_syntax_link_start: wiki_syntax_link_start, wiki_syntax_link_end: '</a>'.html_safe }

.form-group
  = f.label :branch_name_regex, s_("PushRules|Branch name"), class: "label-bold"
  = f.text_field :branch_name_regex, class: "form-control", placeholder: _('Example: (feature|hotfix)\/*'), data: { qa_selector: 'branch_name_field' }
  .form-text.text-muted
    = s_("PushRules|All branch names must match this %{wiki_syntax_link_start}regular expression%{wiki_syntax_link_end}. If empty, any branch name is allowed.").html_safe % { wiki_syntax_link_start: wiki_syntax_link_start, wiki_syntax_link_end: '</a>'.html_safe }
  - if context.is_a?(Project)
    - link_push_rules_url = project_settings_repository_path(context, anchor: 'branch-defaults-settings')
    - link_push_rules_start = '<a href="%{url}" rel="noopener noreferrer">'.html_safe % { url: link_push_rules_url }
    .form-text.text-muted
      = s_('PushRules|Check %{link_start}Branch defaults &gt; Branch name templates%{link_end} for potential conflicts.').html_safe % { link_start: link_push_rules_start, link_end: '</a>'.html_safe }

.form-group
  = f.label :author_email_regex, s_("PushRules|Commit author's email"), class: "label-bold"
  = f.text_field :author_email_regex, class: "form-control", placeholder: _('Example: @sub\.company\.com$'), data: { qa_selector: 'author_email_field' }
  .form-text.text-muted
    = s_("PushRules|All commit author's email must match this %{wiki_syntax_link_start}regular expression%{wiki_syntax_link_end}. If empty, any email is allowed.").html_safe % { wiki_syntax_link_start: wiki_syntax_link_start, wiki_syntax_link_end: '</a>'.html_safe }

.form-group
  = f.label :file_name_regex, s_("PushRules|Prohibited file names"), class: "label-bold"
  = f.text_field :file_name_regex, class: "form-control", placeholder: _('Example: (jar|exe)$'), data: { qa_selector: 'file_name_field' }
  .form-text.text-muted
    = s_('PushRules|All committed filenames cannot match this %{wiki_syntax_link_start}regular expression%{wiki_syntax_link_end}. If empty, any filename is allowed.').html_safe % { wiki_syntax_link_start: wiki_syntax_link_start, wiki_syntax_link_end: '</a>'.html_safe }

.form-group
  = f.label :max_file_size, s_("PushRules|Maximum file size (MB)"), class: "label-bold"
  = f.number_field :max_file_size, class: "form-control", min: 0, data: { qa_selector: 'file_size_field' }
  .form-text.text-muted
    = s_('PushRules|Reject file sizes equal to or greater than this size. If set to 0, files of any size are allowed. This rule does not apply to files tracked by Git LFS.')

= render Pajamas::ButtonComponent.new(type: :submit, variant: :confirm, button_options: { data: { qa_selector: 'submit_settings_button' }}) do
  = s_('PushRules|Save push rules')
